package net.entelijan.cobean.data.util.io;

import java.io.FileInputStream;
import java.io.IOException;

public class FileReader {

	public FileReader() {
		super();
	}

	public void read(String fileName, IInputStreamUser user) {
		try {
			FileInputStream fin = null;
			try {
				fin = new FileInputStream(fileName);
				user.use(fin);
			} finally {
				if (fin != null) {
					fin.close();
				}
			}
		} catch (IOException e) {
			throw new IllegalStateException("Could not read '" + fileName
					+ "' because: " + e.getMessage(), e);
		}
	}

}
